Attribute Click.VB_Description = "Occurs when the user presses and then releases a mouse button over an object."
Event DblClick()
Attribute DblClick.VB_Description = "Occurs when the user presses and releases a mouse button and then presses and releases it again over an object."
Event KeyDown(KeyCode As Integer, Shift As Integer)
Attribute KeyDown.VB_Description = "Occurs when the user presses a key while an object has the focus."
Event KeyPress(KeyAscii As Integer)
Attribute KeyPress.VB_Description = "Occurs when the user presses and releases an ANSI key."
Event KeyUp(KeyCode As Integer, Shift As Integer)
Attribute KeyUp.VB_Description = "Occurs when the user releases a key while an object has the focus."
Event MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Attribute MouseDown.VB_Description = "Occurs when the user presses the mouse button while an object has the focus."
Event MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Attribute MouseMove.VB_Description = "Occurs when the user moves the mouse."
Event MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Attribute MouseUp.VB_Description = "Occurs when the user releases the mouse button while an object has the focus."
Event ItemCheck(Item As Integer)
Attribute ItemCheck.VB_Description = "Occurs when a ListBox control's Style property is set to 1 (checkboxes) and an item's checkbox in the ListBox control is selected or cleared."
Event OLECompleteDrag(Effect As Long)
Attribute OLECompleteDrag.VB_Description = "Occurs at the OLE drag/drop source control after a manual or automatic drag/drop has been completed or canceled."
Event OLEDragDrop(data As DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
Attribute OLEDragDrop.VB_Description = "Occurs when data is dropped onto the control via an OLE drag/drop operation, and OLEDropMode is set to manual."
Event OLEDragOver(data As DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single, State As Integer)
Attribute OLEDragOver.VB_Description = "Occurs when the mouse is moved over the control during an OLE drag/drop operation, if its OLEDropMode property is set to manual."
Event OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean)
Attribute OLEGiveFeedback.VB_Description = "Occurs at the source control of an OLE drag/drop operation when the mouse cursor needs to be changed."
Event OLESetData(data As DataObject, DataFormat As Integer)
Attribute OLESetData.VB_Description = "Occurs at the OLE drag/drop source control when the drop target requests data that was not provided to the DataObject during the OLEDragStart event."
Event OLEStartDrag(data As DataObject, AllowedEffects As Long)
Attribute OLEStartDrag.VB_Description = "Occurs when an OLE drag/drop operation is initiated either manually or automatically."
Event Scroll()
Attribute Scroll.VB_Description = "Occurs when you reposition the scroll box on a control."
' Friend properties to make data structure accessible to walker
Friend Property Get ListItems(i As Long) As String
ListItems = Item(i)
End Property
' NewEnum must have the procedure ID -4 in Procedure Attributes dialog
' Create a new data walker object and connect to it
Public Property Let List(Index As Integer, ByVal sList As String)
lst.List(Index) = sList
PropertyChanged "List"
End Property
' For compatibility
Public Property Get ListCount() As Integer
Attribute ListCount.VB_Description = "Returns the number of items in the list portion of a control."
ListCount = lst.ListCount
End Property
' For compatibility
Public Property Get ListIndex() As Integer
Attribute ListIndex.VB_Description = "Returns/sets the index of the currently selected item in the control."
Attribute ListIndex.VB_MemberFlags = "400"
ListIndex = lst.ListIndex
End Property
Public Property Let ListIndex(ByVal iListIndex As Integer)
lst.ListIndex() = iListIndex
PropertyChanged "ListIndex"
End Property
Public Property Get MouseIcon() As Picture
Attribute MouseIcon.VB_Description = "Sets a custom mouse icon."
Set MouseIcon = lst.MouseIcon
End Property
Public Property Set MouseIcon(ByVal picMouseIcon As Picture)
Set lst.MouseIcon = picMouseIcon
PropertyChanged "MouseIcon"
End Property
Public Property Get MousePointer() As MousePointerConstants
Attribute MousePointer.VB_Description = "Returns/sets the type of mouse pointer displayed when over part of an object."
MousePointer = lst.MousePointer
End Property
Public Property Let MousePointer(ByVal ordMousePointer As MousePointerConstants)
lst.MousePointer() = ordMousePointer
PropertyChanged "MousePointer"
End Property
Public Property Get MultiSelect() As MultiSelectConstants
Attribute MultiSelect.VB_Description = "Returns/sets a value that determines whether a user can make multiple selections in a control."
Dim af As Long
af = GetStyleBits(lst.hWnd)
If af And LBS_MULTIPLESEL Then
MultiSelect = vbMultiSelectSimple
ElseIf af And LBS_EXTENDEDSEL Then
MultiSelect = vbMultiSelectExtended
Else
MultiSelect = vbMultiSelectNone
End If
'MultiSelect = lst.MultiSelect
End Property
Property Let MultiSelect(ordMultiSelectA As MultiSelectConstants)
' lst.MultiSelect = ordMultiSelectA
Select Case ordMultiSelectA
Case vbMultiSelectNone
ChangeStyleBit lst.hWnd, False, LBS_MULTIPLESEL
ChangeStyleBit lst.hWnd, False, LBS_EXTENDEDSEL
Case vbMultiSelectSimple
ChangeStyleBit lst.hWnd, True, LBS_MULTIPLESEL
ChangeStyleBit lst.hWnd, False, LBS_EXTENDEDSEL
Case vbMultiSelectExtended
ChangeStyleBit lst.hWnd, False, LBS_MULTIPLESEL
ChangeStyleBit lst.hWnd, True, LBS_EXTENDEDSEL
End Select
lst.Refresh
PropertyChanged "IntegralHeight"
End Property
Public Property Get NewIndex() As Integer
Attribute NewIndex.VB_Description = "Returns the index of the item most recently added to a control."
NewIndex = lst.NewIndex
End Property
Public Property Get OLEDragMode() As Integer
Attribute OLEDragMode.VB_Description = "Returns/Sets whether this object can act as an OLE drag/drop source, and whether this process is started automatically or under programmatic control."
OLEDragMode = lst.OLEDragMode
End Property
Public Property Let OLEDragMode(ByVal iOLEDragMode As Integer)
lst.OLEDragMode() = iOLEDragMode
PropertyChanged "OLEDragMode"
End Property
Public Property Get OLEDropMode() As Integer
Attribute OLEDropMode.VB_Description = "Returns/Sets whether this object can act as an OLE drop target."
OLEDropMode = lst.OLEDropMode
End Property
Public Property Let OLEDropMode(ByVal iOLEDropMode As Integer)
lst.OLEDropMode() = iOLEDropMode
PropertyChanged "OLEDropMode"
End Property
Public Property Get RightToLeft() As Boolean
Attribute RightToLeft.VB_Description = "Determines text display direction and control visual appearance on a bidirectional system."
RightToLeft = lst.RightToLeft
End Property
Public Property Let RightToLeft(ByVal fRightToLeft As Boolean)
lst.RightToLeft() = fRightToLeft
PropertyChanged "RightToLeft"
End Property
Public Property Get SelCount() As Integer
Attribute SelCount.VB_Description = "Returns the number of selected items in a ListBox control."
SelCount = lst.SelCount
End Property
Public Property Get Selected(Index As Integer) As Boolean
Attribute Selected.VB_Description = "Returns/sets the selection status of an item in a control."
Selected = lst.Selected(Index)
End Property
Public Property Let Selected(Index As Integer, ByVal fSelected As Boolean)
lst.Selected(Index) = fSelected
PropertyChanged "Selected"
End Property
Public Property Get Text() As String
Attribute Text.VB_Description = "Returns/sets the text contained in the control."
Attribute Text.VB_MemberFlags = "424"
Text = lst.Text
End Property
Public Property Let Text(ByVal sText As String)
lst.Text() = sText
PropertyChanged "Text"
End Property
Public Property Get TopItem() As Integer
Attribute TopItem.VB_Description = "Returns/sets which item in a control is displayed in the topmost position."
Attribute TopItem.VB_MemberFlags = "400"
TopItem = lst.TopIndex
End Property
Public Property Let TopItem(ByVal iTopItem As Integer)
lst.TopIndex() = iTopItem
PropertyChanged "TopItem"
End Property
' Delegated methods
Public Sub OLEDrag()
Attribute OLEDrag.VB_Description = "Starts an OLE drag/drop event with the given control as the source."
lst.OLEDrag
End Sub
' Event delegators
Private Sub lst_Click()
RaiseEvent Click
End Sub
Private Sub lst_DblClick()
RaiseEvent DblClick
End Sub
Private Sub lst_KeyDown(KeyCode As Integer, Shift As Integer)
RaiseEvent KeyDown(KeyCode, Shift)
End Sub
Private Sub lst_KeyPress(KeyAscii As Integer)
Static msPrevKeyPress As Long
Dim msCurKeyPress As Long, iKey As Integer
iKey = KeyAscii
If fCompletion Then
msCurKeyPress = GetTickCount
' Check time between keypresses
If (msCurKeyPress - msPrevKeyPress) >= 1000 Then
sPartial = sEmpty
End If
' Handle special case keys
Select Case iKey
Case vbKeyBack
' Handle backspace
If Len(sPartial) Then
PartialWord = Left$(sPartial, Len(sPartial) - 1)
End If
Case Is >= vbKeySpace
' For ASCII keys add keystroke to current partial word
PartialWord = sPartial & Chr$(iKey)
Case Else
' Ignore other control keys
End Select
msPrevKeyPress = msCurKeyPress
' Default text box behavior interferes with
' word completion, so throw away all keypresses
KeyAscii = 0
End If
RaiseEvent KeyPress(iKey)
End Sub
Private Sub UserControl_KeyPress(KeyAscii As Integer)
'RaiseEvent KeyPress(KeyAscii)
End Sub
Private Sub lst_KeyUp(KeyCode As Integer, Shift As Integer)
RaiseEvent KeyUp(KeyCode, Shift)
End Sub
Private Sub lst_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
RaiseEvent MouseDown(Button, Shift, x, y)
End Sub
Private Sub lst_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
RaiseEvent MouseMove(Button, Shift, x, y)
End Sub
Private Sub lst_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
RaiseEvent MouseUp(Button, Shift, x, y)
End Sub
Private Sub lst_ItemCheck(Item As Integer)
RaiseEvent ItemCheck(Item)
End Sub
Private Sub lst_OLECompleteDrag(Effect As Long)
RaiseEvent OLECompleteDrag(Effect)
End Sub
Private Sub lst_OLEDragDrop(data As DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)